/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gadai;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.InputStreamReader;
  
/**
 *
 * @author saiful nur budiman
 */
public class FileGadai {
    double stle;
        double persen_ijaroh;
        int count,pos,index;
        char quote=';';
    public FileGadai(){   
        try{
            FileInputStream fstream=new FileInputStream("gadai");
            DataInputStream in=new DataInputStream(fstream);
            BufferedReader br=new BufferedReader(new InputStreamReader(in));
            String isi;
            count=0;
            index=0;
            while((isi=br.readLine())!=null){
//                stle=Double.parseDouble(isi.substring(0,6));
//                persen_ijaroh=Double.parseDouble(isi.substring(7,9));
                count=0;
                pos=-1;
                for(int i=0;i<isi.length();i++){
                    char content=isi.charAt(i);
                    if(quote==content){
                        if(count==0){
                            stle=Double.parseDouble(isi.substring(pos+1,i));//(1,6)
                            pos=i;
                            count++;
                            //System.out.println("stle: "+stle+" count: "+count+" posisi :"+pos);
                        }
                        else if(count==1){
                            persen_ijaroh=Double.parseDouble(isi.substring(pos+1,i));//(7,9)
                            pos=i;
                            count++;
                            //System.out.println("persen_ijaroh: "+persen_ijaroh+" count: "+count+" posisi :"+pos);
                        }
                    }
                }
            }
        }catch(Exception e){
            System.err.println(e);
        }
    }
    public double getStle(){
        return stle;
    }
    public double getPersenIjaroh(){
        return persen_ijaroh;
    }
    
//    public static void main(String[]args){
//       FileGadai in=new FileGadai();
//       System.out.println(in.getStle());
//       System.out.println(in.getPersenIjaroh());
//    }
}
